﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.IO;

namespace FanPages.Common
{
    public class ImageUtils
    {
        public static byte[] ImageToByteArray(Image imageIn)
        {
            var stream = new MemoryStream();
            imageIn.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg);
            return stream.ToArray();
        }

        public static Image ByteArrayToImage(byte[] byteArrayIn)
        {
            var stream = new MemoryStream(byteArrayIn);
            Image returnImage = Image.FromStream(stream);
            return returnImage;
        }
    }
}
